# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Contributor: Eli Schwartz <eschwartz@archlinux.org>

pkgname=checkbashisms
pkgver=2.22.2
pkgrel=1
pkgdesc='Debian script that checks for bashisms'
arch=('any')
url='https://tracker.debian.org/pkg/devscripts'
license=('GPL')
depends=('perl')
source=("https://salsa.debian.org/debian/devscripts/-/archive/v$pkgver/devscripts-v$pkgver.tar.gz")
sha512sums=('9c08b7f2d4e386bafdab12443ba621204e2ee543f660bd574ad5f8dbfe33c889157dfa6fdf0616528f0735ee79885f67af5cea2da6e3aea6858ce945735251aa')
b2sums=('c2e2d0cf322c3e31d3b4acc55683ed0a83d93ac8113de30d25f37a17700470d8ef1aeed00ad169ae4569f99bf4b710010e4ab4e06d4b9e198a1b42dfd9ebe9fd')

prepare() {
  cd "devscripts-v$pkgver/scripts"

  sed "s/###VERSION###/$pkgver/g" checkbashisms.pl > checkbashisms
}

package() {
  cd "devscripts-v$pkgver/scripts"

  # binary
  install -vDm755 -t "$pkgdir/usr/bin" "$pkgname"

  # man page
  install -vDm644 -t "$pkgdir/usr/share/man/man1" "$pkgname.1"

  # bash completions
  install -vDm644 "$pkgname.bash_completion" "$pkgdir/usr/share/bash-completion/completions/$pkgname"
}
